/*******************************************************************************
 * Package: switch1
 * Type:    SwitchExpression
 * Date:    2024-10-15 11:04
 *
 * Copyright (c) 2024 LTD All Rights Reserved.
 *
 * You may not use this file except in compliance with the License.
 *******************************************************************************/
package switch1;

/**
 * 功能描述：
 *switch 语句可以作为表达式使用，并且返回一个值。
 * @author Songxianyang
 * @date 2024-10-15 11:04
 */
public class SwitchExpression {
    public static void main(String[] args) {
        int i=2;
       String name= switch (i) {
            case 1 -> "my-1";
            case 2 -> "my-2";
            case 3 -> "my-3";
            default -> "my";
        };
        System.out.println(name);
    }
}
